/* 
 * @(#) ChangeAction.java  1.0  2004-4-22 
 * 
 * Copyright 2003 by LongTop Corporation. 
 * All rights reserved. 
 * 
 * This software is the confidential and proprietary information of 
 * LongTop Corporation ("Confidential Information").  You 
 * shall not disclose such Confidential Information and shall use 
 * it only in accordance with the terms of the license agreement 
 * you entered into with LongTop. 
 */

package com.cnc.ssm.web;


import com.cnc.bas.IBasService;
import com.cnc.bas.util.Constants;
import com.cnc.bas.web.SecureBaseDispatchAction;
import com.cnc.ssm.ISsmService;
import com.cnc.ssm.UserInfo;
import com.cnc.ssm.model.PwInst;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;

/**
 * @author du bf
 * @version 1.0 2004-4-22 10:13:18
 */
public class ChangeAction extends SecureBaseDispatchAction {


    public ActionForward listSuperEmployee(ActionMapping mapping,
                                         ActionForm form,
                                         HttpServletRequest request,
                                         HttpServletResponse response) throws Exception {
        String instCode = request.getParameter("transferParam");//inst code
        String emplType = request.getParameter("emplType");
        StringBuffer name = new StringBuffer();
        StringBuffer value = new StringBuffer();
        ISsmService ssmService = (ISsmService) this.getBean(Constants.BEAN_NAME_SSM);
        if (emplType.equals("3")) //���Ϊ��ͨ��Ա
        {
            emplType = "2"; //���ϼ�Ϊҵ�����
        }
        List list = ssmService.listSuperEmployee(instCode, emplType);
        int i = 0;
        Iterator iter = list.iterator();
        while (iter.hasNext()) {
            i++;
            HashMap hm = (HashMap) iter.next();
            String codeValue = String.valueOf(hm.get("EMPL_CODE"));
            String codeName = String.valueOf(hm.get("EMPL_NAME"));
            value.append((i == 1 ? codeValue.trim() : "," + codeValue.trim()));
            name.append((i == 1 ? codeName.trim() : "," + codeName.trim()));
        }
        request.setAttribute("name", name.toString());
        request.setAttribute("value", value.toString());
        return mapping.findForward("list");
    }


}

